<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib prefix="fmt" 
           uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>注册</title>
  <link rel="stylesheet" href="${pageContext.request.contextPath }/html/css/sigin.css">
  <style>
  /* http://meyerweb.com/eric/tools/css/reset/ */
/* v1.0 | 20080212 */

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td ,a{
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    font-size: 100%;
    vertical-align: baseline;
    background: transparent;
    text-decoration: none;
}
body {
    line-height: 1;
}
ol, ul {
    list-style: none;
}
blockquote, q {
    quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
    content: '';
    content: none;
}

/* remember to define focus styles! */
:focus {
    outline: 0;
}

/* remember to highlight inserts somehow! */
ins {
    text-decoration: none;
}
del {
    text-decoration: line-through;
}

/* tables still need 'cellspacing="0"' in the markup */
table {
    border-collapse: collapse;
    border-spacing: 0;
}


  </style>
  	<script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js">
	</script>
</head>
<body>
  <div class="wrap" style="background-color:#f7f7f7;">

    <div class="header">
    	<ul id="nav" style="margin-left:634px">
    		<li><a href=""><span style="font-size:30px;">用户注册</span></a></li>
    	 </ul>
     <div class="top">
     <%--  <img src="${pageContext.request.contextPath }/html/images/logo.png" id="logo"/>

      <ul id="nav">
        <li><a href=""><span>首页</span></a></li>
        <li><a href=""><span>我的资产</span></a></li>
        <li><a href=""><span>我的投资</span></a></li>
        <li><a href=""><span>我的融资</span></a></li>

      </ul>

      <ul id="login">
          <li><a href=""><span>我的账户</span></a></li>
          <li><img src="${pageContext.request.contextPath }/html/images/down.png" id="line"/></li>
      </ul>
 --%>
    </div><!--top-->
    	
    </div><!--header-->
<form action="${pageContext.request.contextPath }/user/signup" method="post"> 
    <div class="main">
      <div class="sr" style="height: 245px;">
         <div class="sj">
	         <p style="float:left;line-height:28px;margin-left:12px;">手机号码：</p>
	         <input type="text"  value="请输入手机号码" class="input"  name="phonenum" id="phonenum" onblur="a()"
	         style="font-size:12px;color:#a4aab3;line-height:14px;padding-left:10px;">
			 <label id="repeat1" style="position:absolute;left:861px;top:245px;"></label>
      	 </div><!--sj-->
      	
	      <div class="sj">
		      <p style="float:left;line-height:28px;margin-left:35px;">昵称：</p>
		      <input type="text"  value="请输入昵称" class="input"  name="name" id="name"
		      style="font-size:12px;color:#a4aab3;line-height:14px;padding-left:10px;">
	      </div><!--sj-->
	      
		    <div class="sj">
			    <p style="float:left;line-height:28px;margin-left:11px;">常用邮箱：</p>
			    <input type="text"  value="请输入邮箱" class="input" name="email" id="email" onblur="b()"
			    style="font-size:12px;color:#a4aab3;line-height:14px;padding-left:10px;">
				<label id="repeat2" style="position:absolute;left:861px;top:342px;"></label>	
		     </div><!--sj-->
		     
			  <div class="sj">
			    <p style="float:left;line-height:28px;margin-left:23px;">用户名：</p>
			  <input type="text"  value="请输入用户名" class="input" name="username" id="username"
			  style="font-size:12px;color:#a4aab3;line-height:14px;padding-left:10px;">
			  <label id="repeat" style="position:absolute;left:861px;top:389px;"></label>
			</div><!--sj-->
			
			<div class="sj">
			  <p style="float:left;line-height:28px;margin-left:12px;">设置密码：</p>
			<input type="text"  value="请输入密码" class="input"   name="password" id="password"
			style="font-size:12px;color:#a4aab3;line-height:14px;padding-left:10px;">
			</div><!--sj-->
			
      </div><!--sr-->
      
        <div class="clear" style="margin-left:462px;margin-bottom: 70px">
        	 <input type="radio" name="sex" value="male" checked="checked">Male&nbsp&nbsp&nbsp&nbsp<input type="radio" name="sex" value="female">Female
        </div>
       
  		<div class="ty">
        <input name="" type="checkbox" class="tyinput" id="mytyinput"/>
        <p class="tyxy">已阅读并同意<span style="color:#333;">《注册服务协议》</span></p>
  			</div><!--ty-->
  <button type="button" onclick="check()" class="btn">
 	  <span>确认注册</span>
  </button>
    </div><!--main-->
</form>
    <div class="foot">
        <p>  服务条款 | 关于我们 | 联系我们 </p>
        <p>Copyright © Wanda. All Rights Reserved.</p>
    </div>
<script>
$(document).ready(function()
		{
		$("#username").blur
		(
		function(){
		$.ajax({
				url:"${pageContext.request.contextPath }/user/checkusername?username="+$("#username").val(),
				type:"get",
				success:function(result)
				{
					if($.trim($("#username").val())=="")
					{
						return;
					}
					 if(result=="true")
					{
						$("#repeat").html("<span style='color:green'>用户名可用</span>");
						return;
					}
					else
					{
						$("#repeat").html("<span style='color:red'>用户名已存在</span>");
					}
						
				}	
		})})})
	function a()
	{
		var str = $("#phonenum").val();
	    var ret = /^1[34578]\d{9}$/;
	    if(!(ret.test(str))){
	    	$("#repeat1").html("<span style='color:red'>号码格式错误</span>");
	    	return;
	    }
		$("#repeat1").empty();
	}
	function b()
	{
		var str = $("#email").val();
	    var ret = /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/;
	    if(!(ret.test(str))){
	    	$("#repeat2").html("<span style='color:red'>邮箱格式错误</span>");
	    	return;
	    }
	
		$("#repeat2").empty();
	}
		
	function check() {
	
	    if($.trim($("#username").val())=="请输入用户名") {
	           alert("请输入用户帐号!");
	           return false;
	      }
	  	if($.trim($("#password").val())=="请输入密码"){
	           alert("请输入登录密码!");
	           return false;
	    }
	  	if($.trim($("#phonenum").val())=="请输入手机号码"){
	        alert("请输入电话!");
	        return false;
	 }
	  	if($.trim($("#name").val())=="请输入昵称"){
	        alert("请输入昵称!");
	        return false;
	 }
	  	if($.trim($("#email").val())=="请输入邮箱"){
	        alert("请输入邮箱!");
	        return false;
	 }
	  	if($("#mytyinput").is(':checked')==false){
	        alert("请阅读用户注册协议");
	        return false;
	 }
	  $("form")[0].submit();
	}
</script>
	
</div><!--wrap-->
</body>
</html>
